<?php	
	require_once('start_session.php');
	require_once('db_connect.php');
	require_once('header.php');
	require_once('footer.php');
	//setcookie('user_id','aeraim');
	
	$item_count = array();
	if($_GET['survey_id'])
	{
		$survey_id = $_GET['survey_id']; //수정 모드	
		if($survey_id)
		{
			$sql = "SELECT * FROM survey WHERE id=$survey_id";
			$result = mysqli_query($conn, $sql);
			if($result)
			{
				$row=mysqli_fetch_array($result);
				$title = $row[title];
				$is_once = $row[is_once];
				$start_date = $row[start_date];
				$end_date = $row[end_date];
				$start_time = $row[start_time];			
				$end_time = $row[end_time];
				$max_capacity = $row[max_capacity];
				$require_login = $row[require_login];
				$mid_result = $row[mid_result];	
				$ap_id = $row[ap_id];				
				$gps_id = $row[gps_id];				
				$category = $row[category];
				$member_id = $row[memeber_id];				
			}
			$start_time1 = substr($start_time,0,2);
			$start_time2 = substr($start_time,3,2);
			$end_time1 = substr($end_time,0,2);
			$end_time2 = substr($end_time,3,2);
			
			if($ap_id)
			{
				$sql = "SELECT locatename FROM standard_ap WHERE ap_id=$ap_id";
				$result = mysqli_query($conn, $sql);
				$row = mysqli_fetch_array($result);
				$locatename = $row[locatename];
			}
			if($gps_id)
			{
				$sql = "SELECT locatename FROM standard_gps WHERE gps_id=$gps_id";
				$result = mysqli_query($conn, $sql);
				$row = mysqli_fetch_array($result);
				$locatename = $row[locatename];
			}
			
				
									
			$sql = "SELECT basic_keyword FROM category WHERE name='$category'";
			$result = mysqli_query($conn, $sql);			
			$row=mysqli_fetch_array($result);
			$keyword1 = $row[basic_keyword];
			
			
			$tok1 = strtok($keyword1, ",");
			$tok2 =	strtok(",");		
			$tok3 = strtok(",");			
			$tok4 = strtok(",");
			$tok5 = strtok(",");
			
			$sql = "SELECT keyword FROM keyword_survey WHERE survey_id=$survey_id";
			$result = mysqli_query($conn, $sql);
			while($row=mysqli_fetch_array($result))
			{				
				$temp = $row[keyword];
				if($temp != $tok1 && $temp != $tok2 && $temp != $tok3 && $temp != $tok4 && $temp != $tok5)
					$keyword2 = $temp.",".$keyword2;
			}			
			//$keyword2 = substr($keyword,strlen($keyword1)+1);				
			
			$sql = "SELECT * FROM basic_condition WHERE survey_id=$survey_id";
			$result = mysqli_query($conn, $sql);			
			if($result)
			{
				$i=0;
				while($row=mysqli_fetch_array($result))
				{
					$i++;
					$age_cond[$i]=$row[age];
					$gender_cond[$i] = $row[gender];
					$edulevel_cond[$i] = $row[edulevel];
					$locatename_cond[$i] = $row[addr];					
				}
				$basic_count = $i;
			}			
			$sql = "SELECT * FROM question WHERE survey_id=$survey_id";
			$result = mysqli_query($conn, $sql);			
			if($result)
			{
				$i=0;				
				while($row=mysqli_fetch_array($result))
				{
					
					$i++;
					$question[$i]=$row[qtitle];
					$question_du[$i] = $row[is_multi];
					$qnum[$i]=$row[qnumber];
					$sql = "SELECT * FROM item WHERE survey_id=$survey_id AND qnum=$qnum[$i]";
					$result2 = mysqli_query($conn, $sql);					
					if($result2)
					{
						$j=0;
						while($row=mysqli_fetch_array($result2))
						{
							$j++;
							$item[$i][$j]=$row[ititle];							
						}						
						$item_count[$i]=$j;						
					}
	
				}
				$question_count = $i;
			}			
		}
	}	
	else
	{
		$survey_id = 0;
		$question_count = 0;
		$basic_count = 0;
		$require_login = 0;
		$mid_result=0;
		$is_once=0;
		$start_time1=0;
		$start_time2=0;
		$end_time1=0;
		$end_time2=0;
	}
		
	$test = "메롱";		
?>

<html>
	<body>
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">		
		<script type="text/javascript" src="./js/util.js"></script>
		<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="js/ui.datetimepicker.js"></script>
		<script type="text/javascript">
				var item_count = new Array(100);
				var question_= new Array(100);
				var question_du = new Array(100);
				var item_= new Array(100);
				var age_ = new Array(10);
				var gender_ = new Array(10);
				var edulevel_ = new Array(10);
				var locatename_ = new Array(10);				
				for(var i=0; i<100; i++)
					item_[i]=new Array(20);
					
				function trans(i,x){
					item_count[i]=x;								
				}				
				function save(i,x){
					question_[i]=x;
				}			
				function save2(i,j,x){
					item_[i][j]=x;
				}
				function save3(i,x){
					question_du[i]=x;
				}
				function age(i,x){
					age_[i]=x;
				}
				function gender(i,x){
					gender_[i]=x;
				}
				function edulevel(i,x){
					edulevel_[i]=x;
				}
				function locatename(i,x){
					locatename_[i]=x;
				}
		</script>
		<?php
			if($_GET['survey_id'])
			{
					echo"<script language=javascript>";
					for($i=1; $i<100; $i++)
						echo("trans(\"$i\",\"$item_count[$i]\");");
					for($i=1; $i<100; $i++)
					{
						echo("save(\"$i\",\"$question[$i]\");");
						echo("save3(\"$i\",\"$question_du[$i]\");");
					}
					for($i=1; $i<100; $i++)
					{
						for($j=1; $j<20; $j++)
						{
							$temp = $item[$i][$j];
							echo("save2(\"$i\",\"$j\",\"$temp\");");
						}
					}
					for($i=1; $i<10; $i++)
					{
						echo("age(\"$i\",\"$age_cond[$i]\");");
						echo("gender(\"$i\",\"$gender_cond[$i]\");");
						echo("edulevel(\"$i\",\"$edulevel_cond[$i]\");");
						echo("locatename(\"$i\",\"$locatename_cond[$i]\");");
					}
					echo "</script>";	
			}
		?>
		<link rel="stylesheet" type="text/css" href="css/dark.datetimepicker.css" />
		<script type="text/javascript">

		$(document).ready(function() {

		$("#start_date").datetimepicker({dateFormat: 'yy-mm-dd', dayNamesMin: ['일', '월', '화', '수', '목', '금', '토']});
		$("#end_date").datetimepicker({dateFormat: 'yy-mm-dd', dayNamesMin: ['일', '월', '화', '수', '목', '금', '토']});

		});

		</script>
		<script type="text/javascript">
				function check_id()
				{
					window.open("check_id.php?id="+document.member_form.id.value,"IDcheck","left=200, top=200, width=250, height=100, scrollbar=no, resizable=yes");
				}						
				function modify()
				{					
					
					if(<?=$survey_id?>)
					{
						for(var i=0; i< <?=$question_count?>; i++)
						{
							appendItem();							
							for(var j=0; j< (item_count[i+1]-2); j++)
								appendItem2(i+1);
						}	

						for(var i=0; i< <?=$basic_count?>; i++)
						{
							appendCond();
						}
						
						document.getElementById('title').value = "<?=$title?>";
						document.getElementById('category').value = "<?=$category?>";
						document.getElementById('keyword1').value = "<?=$keyword1?>";
						document.getElementById('keyword2').value = "<?=$keyword2?>";						
						for(var i=0; i< <?=$question_count?>; i++)
						{
							document.getElementById('question_'+(i+1)).value = question_[i+1];
							document.getElementById('question_'+(i+1)+'_du').checked = parseInt(question_du[i+1]);
							for(var j=0; j< item_count[i+1]; j++)
								document.getElementById('item_'+(i+1)+'_'+(j+1)).value = item_[i+1][j+1];
						}
						document.getElementById('start_date').value = "<?=$start_date?>";
						document.getElementById('end_date').value = "<?=$end_date?>";
						document.getElementById('member_confirm').checked = <?=$require_login?>;
						document.getElementById('result_open').checked = <?=$mid_result?>;
						
						if(<?=$is_once?>)
							document.getElementById('is_once2').checked = 1;
						else
							document.getElementById('is_once1').checked = 1;
						
						document.getElementById('max_capacity').value = "<?=$max_capacity?>";
						document.getElementById('start_time_1').value = <?=$start_time1?>;
						document.getElementById('start_time_2').value = <?=$start_time2?>;
						document.getElementById('end_time_1').value = <?=$end_time1?>;
						document.getElementById('end_time_2').value = <?=$end_time2?>;
						document.getElementById('locatename').value = "<?=$locatename?>";
						for(var i=0; i< <?=$basic_count?>; i++)
						{
							document.getElementById('age_cond_'+(i+1)).value = age_[i+1];
							document.getElementById('gender_cond_'+(i+1)).value = gender_[i+1];
							document.getElementById('edulevel_cond_'+(i+1)).value = edulevel_[i+1];
							document.getElementById('locatename_cond_'+(i+1)).value = locatename_[i+1];
						}
											
						
						
					}
				}						
				function check_input()
				{
					
					if(!document.survey_form.title.value)
					{
						alert("설문제목을 입력하세요");
						document.survey_form.title.focus();
						return;
					}
					
					if(!document.survey_form.category.value)
					{
						alert("카테고리를 선택해주세요");
						document.survey_form.category.focus();
						return;
					}
					
					if(!document.survey_form.keyword2.value)
					{
						alert("키워드를 입력해주세요");
						document.survey_form.keyword2.focus();
						return;
					}
					
					var root = document.getElementById("itemList");
					if(root.hasChildNodes())
					{
						for(i=0; i<root.childNodes.length; i++){							
							var currentNode = root.childNodes[i];
							if(!currentNode.childNodes[1].value){
							alert("문항을 입력해주세요");
							currentNode.childNodes[1].focus();
							return;
							}
							for(j=6; j<currentNode.childNodes.length; j++)
							{
								var cont_child = currentNode.childNodes[j];																						
								if(!cont_child.childNodes[1].value){
								alert("항목을 입력해주세요");
								cont_child.childNodes[1].focus();
								return;
								}
							}						
						}
					}
					
					if(!document.survey_form.start_date.value)
					{
						alert("설문시작날짜를 입력해주세요");
						document.survey_form.start_date.focus();
						return;
					}
					if(!document.survey_form.end_date.value)
					{
						alert("설문종료날짜를 입력해주세요");
						document.survey_form.end_date.focus();
						return;
					}
					
						
					
					
					/*
					if(!document.survey_form.max_capacity.value)
					{
						alert("참여가능인원을 입력해주세요");
						document.survey_form.max_capacity.focus();
						return;
					}
					if(!document.survey_form.locatename.value)
					{
						alert("거주지역을 입력해주세요");
						document.survey_form.locatename.focus();
						return;
					}
					*/
					
					
					document.survey_form.submit();
				}
				
				function reset_form()
				{
					<!-- 주석예압 초기화할 변수들 여기에 집어 넣긔 -->
					document.member_form.id.value = "";
					document.member_form.name.value = "";
					document.member_form.passwd.value = "";
					document.member_form.passwd_confirm.value = "";
					document.member_form.address.value = "";
				}
				function back()
				{
					top.location.href='main.php';
				}
				/*				
				if (typeof ActiveXObject != 'undefined')
				{
				XMLHttpRequest = function ()
				{
					return new ActiveXObject(navigator.userAgent.indexOf('MSIE 5') >-1 ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP');
				};
				}				
				var xhr = new XMLHttpRequest();				
*/
				function getXMLHttpRequest(){
					if(window.XMLHttpRequest){
						return new XMLHttpRequest();
					}else if(window.ActiveXObject){
						try{
								return new ActiveXObject("Msxml2.XMLHTTP");
							}catch(e){
								try{
										return ActiveXObject("Microsoft.XMLHTTP");
									}catch(e){
										return null;
									}
							}
						}
					else{
						return null;
					}
					
				}
				var xhr = getXMLHttpRequest();
								
				// 객체 생성하고 함수 생성
				function Select_keyword(obj)
				{
					var name = obj.value;
					var url = "request_keyword.php?name="+name;
					xhr.open("Get",url,true);
					xhr.onreadystatechange = callback;
					xhr.send();
				}
				function callback()
				{					
					if (xhr.readyState == 4)
					{							
						if (xhr.status == 200)
						{							
							var txt = xhr.responseText;
							document.getElementById('keyword1').value = txt;
							//innerHTML
						}
					}
				}		
				
				//문항관련 함수
				var count = 0;
				var subcount=[];
				
				for(i=0; i<100; i++)
					subcount[i] = 0;
				
				function appendItem()
				{
					count++;
					var newItem = document.createElement("div");
					newItem.setAttribute("id","item_"+count);
					var html = '<div id="inner_'+count+'" style="display:inline;">문항[' + count +']</div>' +
						'<input type="text" size="60" name="question_'+count+'" id="question_'+count+'">'+
						'<input type="button" value="삭제" onclick = "removeItem('+ count +')">'+
						'<input type="button" value="항목추가" onclick ="appendItem2('+ count +')">'+
						'중복허용<input type="checkbox" value="1" name="question_'+count+'_du" id="question_'+count+'_du">';
					newItem.innerHTML = html;
					
					var itemListNode = document.getElementById('itemList');
					itemListNode.appendChild(newItem);
					
					appendItem2(count);
					appendItem2(count);
					flat_1();
				}
				
				function appendItem2(count)
				{
					subcount[count]++;
					var newItem = document.createElement("div");
					newItem.setAttribute("id","iitem_"+count+"_"+subcount[count]);										
					var html = '<div class=item id="inner2_'+subcount[count]+'" style="display:inline; padding-left:30;">항목[' + subcount[count] +']</div>'+
						'<input class=item type="text" size="30" name="item_'+count+'_'+subcount[count]+'" id="item_'+count+'_'+subcount[count]+'">'+
						'<input class=item type="button" value="삭제" onclick = "removeItem2('+ count +','+subcount[count] +')">';
					newItem.innerHTML = html;
					
					var itemListNode = document.getElementById('item_'+count);
					itemListNode.appendChild(newItem);
					flat_2(count);
				}
				
				//항목
				function removeItem2(count, idCount)
				{	
					var item = document.getElementById("iitem_"+count+"_"+idCount);
										
					if(item!=null)
					{	
						var parent = item.parentNode;
						if(parent.childNodes.length < 9)
						{
							alert("항목은 최소 두개 이상이어야 합니다");
							return;
						}
						
						item.parentNode.removeChild(item);
						
						flat_2(count);						
					}
				}		
				//문항
				function removeItem(idCount)
				{
					var item = document.getElementById("item_"+idCount);
					var root = document.getElementById("itemList");
					if(root.childNodes.length < 2)
					{
						alert("문항은 최소 한개 이상이어야 합니다");
						return;
					}
							
					if(item!= null)
					{
						item.parentNode.removeChild(item);										
						flat_1();
					}
					
					
				}
				function flat_1()
				{
					var root = document.getElementById("itemList");
					if(root.hasChildNodes())
					{
							for(i=0; i<root.childNodes.length; i++){							
								var currentNode = root.childNodes[i];
								currentNode.firstChild.innerHTML = "문항["+ (i+1) +"]";							
							}
					}
				}
				function flat_2(count)
				{
					var root = document.getElementById("item_"+count);
					if(root.hasChildNodes())
					{
							for(i=6; i<root.childNodes.length; i++){							
								var currentNode = root.childNodes[i];
								currentNode.firstChild.innerHTML = "항목["+ (i-5) +"]";							
							}
					}
				}				
				
				var condCount = 0;
				function appendCond()
				{
					condCount++;
					var newItem = document.createElement("div");
					newItem.setAttribute("id","cond_"+condCount);
					var html = '<div id="inner_'+condCount+'" style="display:inline;">기본조건['+condCount+']</div>' +
						'<select name=age_cond_'+condCount+' id=age_cond_'+condCount+'>'+
						'<option value="">'+'연령대'+
						'<option value=10>'+'10대'+
						'<option value=20>'+'20대'+
						'<option value=30>'+'30대'+
						'<option value=40>'+'40대'+
						'<option value=50>'+'50대'+
						'<option value=60>'+'60대'+
						'</select>'+'&'+
						'<select name=gender_cond_'+condCount+' id=gender_cond_'+condCount+'>'+
						'<option value="">'+'성별'+
						'<option value=1>'+'남'+
						'<option value=2>'+'여'+
						'</select>'+'&'+
						'<select name=edulevel_cond_'+condCount+' id=edulevel_cond_'+condCount+'>'+
						'<option value="">'+'학력'+
						'<option value=1>'+'중졸 이하'+
						'<option value=2>'+'고졸'+
						'<option value=3>'+'초대졸'+
						'<option value=4>'+'대졸'+
						'<option value=5>'+'대학원졸 이상'+						
						'</select>'+'&'+
						'<input type="text" size="35" name="locatename_cond_'+condCount+'" id="locatename_cond_'+condCount+'">'+
						'<input type="button" value="주소선택" onclick=openPopup("select_location.php?form_name=survey_form&addr_field_name=locatename_cond_'+condCount+'","select",320,240)>'+
						'<input type="button" value="조건삭제" onclick="remove('+condCount+')" >';
						
					newItem.innerHTML = html;					
					var itemListNode = document.getElementById('CondList');
					itemListNode.appendChild(newItem);	
					flat_cond()
				}
				
				function remove(num)
				{
					var item = document.getElementById("cond_"+num);
					var root = document.getElementById("CondList");
					if(root.childNodes.length < 2)
					{
						alert("조건은 최소 한개 이상이어야 합니다");
						return;
					}
							
					if(item!= null)
					{
						item.parentNode.removeChild(item);										
						flat_cond()
					}
				}
				
				function flat_cond()
				{
					var root = document.getElementById("CondList");
					
					if(root.hasChildNodes())
					{
							for(i=0; i<root.childNodes.length; i++){							
								var currentNode = root.childNodes[i];
								currentNode.firstChild.innerHTML = "기본조건["+ (i+1) +"]";							
							}
					}
				}		
				
				function default_load()
				{
					if(<?=$survey_id?>)
					{
						modify();
						document.getElementById("survey_id").value = <?=$survey_id?>;						
					}
						
					else	
					{	
						appendItem();				
						appendCond();
					}
					
				}							
				</script>								
				</head>
				<body topmargin="0" onload=default_load()>	  
			        
          <form name=survey_form id=survey_form method=post action=insert_survey_load.php>
          <table id=survey_form_table border=1 width=99% style=margin:auto>
          <tr>
            <td bgcolor=#FFFFFF>
          
		  <fieldset>
			<legend> 필수입력사항 </legend>
            <table border="0" cellspacing="1" cellpadding="4" >
              <tr>
			    <td width=20% bgcolor=#f7f7f7 align=right style=padding-right:6>
                * 회원 ID 							
				</td>
                <td bgcolor=#ffffff style=padding-left:10> 
				<?php
					$id = $_COOKIE[user_id];
					echo $id;
				?>
              </tr>
              
              <tr>
              <td bgcolor=#f7f7f7 align=right style=padding-right:6>
              * 설문제목  </td>
              <td bgcolor=#ffffff style=padding-left:10>
              <input type=text size=60 class=m_box id=title name=title></td>
              </tr>
              
              <tr>
              <td bgcolor=#f7f7f7 align=right style=padding-right:6>
              * 카테고리  </td>
              <td bgcolor=#ffffff style=padding-left:10>
			  <select class=input2 id=category name=category onchange=Select_keyword(this)>
			  <option value=''>
			  <?php
			  		require_once('db_connect.php');
					
					$sql = "select * from category";
					
					$result=mysqli_query($conn, $sql);
					$num_row = mysqli_num_rows($result);
																			
					while($row=mysqli_fetch_array($result))
					{										
					echo "<option value='$row[name]'>";
					echo $row[name];
					echo "</option>";
					}							
			  ?>
			  </select>
              </td>
              </tr>
              
               <tr>
              <td bgcolor=#f7f7f7 align=right style=padding-right:6>
              * 키워드  </td>
              <td bgcolor=#ffffff style=padding-left:10>
			  <input type=text id=keyword1 name=keyword1>
              <input type=text id=keyword2 class=m_box size=20 name=keyword2></td>
              </tr>
			  
			  
			 <tr>
			   <td bgcolor=#f7f7f7 align=right style=padding-right:6>
              * 문항 </td>
			  <td bgcolor=#ffffff style=padding-left:10>
			 <input type = 'button' value='문항추가' onclick='appendItem()' >
			 <div id = "itemList"></div>
			 </td>
			 </tr>
			  
			  <tr>
                <td bgcolor=#f7f7f7 align=right style=padding-right:6>
                * 설문시작날짜</td>
                <td bgcolor=#ffffff style=padding-left:10>
                <input type=text id=start_date name=start_date readonly>							
                </td>
              </tr> 
			  
			   <tr>
                <td bgcolor=#f7f7f7 align=right style=padding-right:6>
                * 설문종료날짜</td>
                <td bgcolor=#ffffff style=padding-left:10>
                <input type=text id=end_date name=end_date readonly>				     
                </td>
              </tr>		 
			  	  
			   <tr>
                <td bgcolor=#f7f7f7 align=right style=padding-right:6>
                * 회원인증필요</td>
                <td bgcolor=#ffffff style=padding-left:10>
                <input type=checkbox id=member_confirm name=member_confirm value = 1>
                </td>
              </tr>		  
			  
			  <tr>
                <td  bgcolor=#f7f7f7 align=right style=padding-right:6 rowspan=3>
                * 중간결과공개</td>
                <td bgcolor=#ffffff style=padding-left:10>                
				<input type=checkbox id=result_open name=result_open value = 1>				
                </td>
              </tr>
			  
			  
			  
			  
            </table>
			</fieldset>
			<fieldset>
			<legend>선택입력사항</legend>
			<table border="0" cellspacing="1" cellpadding="4">
              <tr>
                <td width=20% bgcolor=#f7f7f7 align=right style=padding-right:6>
                * 유형  </td>
                <td bgcolor=#ffffff style=padding-left:10>
                <input type=radio name=is_once id=is_once1 value = 0 checked> 일회성
                <input type=radio name=is_once id=is_once2 value = 1> 반복성
                </td>
              </tr>
			  			  
			   <tr>
                <td  bgcolor=#f7f7f7 align=right style=padding-right:6>
                * 참여인원 </td>
                <td bgcolor=#ffffff style=padding-left:10>
                <input type=text id=max_capacity name=max_capacity size=8 value="0" style="text-align:right;">명 *default:0(무제한)
                </td>
              </tr>
			   <tr>
                <td bgcolor=#f7f7f7 align=right style=padding-right:6>
                * 설문가능 시간대 설정</td>
                <td bgcolor=#ffffff style=padding-left:10>
                <select id=start_time_1 name=start_time_1>
				
				<?php
					for($i=0; $i < 25; $i++)
					{
						echo "<option value='$i'>";
						if($i < 10)
							echo "0".$i;
						else
							echo $i;
						echo "</option>";
					}	
				?>
				</select>시
				<select id=start_time_2 name=start_time_2>
				
				<?php
					for($i=0; $i < 61; $i++)
					{
						echo "<option value='$i'>";
						if($i < 10)
							echo "0".$i;
						else
							echo $i;
						echo "</option>";
					}	
				?>
				</select>분 ~
				<select id=end_time_1 name=end_time_1>				
				<?php
					for($i=0; $i < 25; $i++)
					{
						if($i==24)
							echo "<option value='$i' selected>".$i."</option>";
						else
						{	
							echo "<option value='$i'>";
							if($i < 10)
								echo "0".$i;
							else
								echo $i;
							echo "</option>";
						}
					}	
				?>
				</select>시
				<select id=end_time_2 name=end_time_2>				
				<?php
					for($i=0; $i < 61; $i++)
					{
						echo "<option value='$i'>";
						if($i < 10)
							echo "0".$i;
						else
							echo $i;
						echo "</option>";
					}	
				?>
				</select>분			
                </td>
              </tr>			  
			  <tr>
                <td  bgcolor=#f7f7f7 align=right style=padding-right:6>
                * 위치조건 </td>
                <td bgcolor=#ffffff style=padding-left:10>
                실내<input type=text id=locatename name=locatename size=50 readonly>
				<input type=button value=선택 onclick=openPopup("location_condition.php?form_name=survey_form&addr_field_name=locatename&addr_field_name2=locatename2","select",600,250)>						
                </td>
              </tr>
			  
			  <tr>
                <td  bgcolor=#f7f7f7 align=right style=padding-right:6>
                </td>
                <td bgcolor=#ffffff style=padding-left:10>				
				실외<input type=text id=locatename2 name=locatename2 size=50 readonly>
                </td>
              </tr>
			  
			  <tr>
			   <td bgcolor=#f7f7f7 align=right style=padding-right:6>
              * 기본조건 </td>
			  <td bgcolor=#ffffff style=padding-left:10>
			 <input type = 'button' value='추가' onclick='appendCond()' >
			 </td>
			 </tr>
			 
			 <tr>
			   <td bgcolor=#f7f7f7 align=right style=padding-right:6>
              </td>
			  <td bgcolor=#ffffff style=text-align:center>
			<!-- <input type="button" value="연령대">&
			 <input type="button" value="성별">&
			 <input type="button" value="학력">&
			 <input type="button" value="거주지주소">			 
			 !-->
			<div id = "CondList"></div>
			 </td>
			 </tr>			
            <tr>
			  <td bgcolor=#f7f7f7 align=right style=padding-right:6></td>
              <td align=center bgcolor=#ffffff height=30>
		      <input type=reset value="다시쓰기">
			  <input id=insert type=button value="설문등록" onclick=check_input()>			  
              <input type=button value="취소하기" onclick=back()></td>
            </tr>
			</fieldset>
            </form>			
           </body>
         </html>		
				
				
				
				
					
					

					